<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/prettyphoto.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.prettyphoto.js"></script>
<script type="text/javascript">
$(function(){
	$("a[rel^='pretty_photo']").prettyPhoto({theme:'facebook'});
	$(".datepicker").datepicker({dateFormat:'yy-mm-dd',changeMonth:true});
});
</script>
<fieldset><legend>查询条件</legend>
<form method="get">
<? include(Q::ini('custom_system/elements_dir') . 'searchform_element.php');?>
<table class="form_table">
<tr>
	<th>日期：</th>
	<td>
		<input type="text" class="datepicker" name="begin" value="<?=isset($_GET['begin'])?$_GET['begin']:''?>" /> to 
		<input type="text" class="datepicker" name="end" value="<?=isset($_GET['end'])?$_GET['end']:''?>" />
	</td>
</tr>
<tr>
	<th>产品编号</th>
	<td><input type="text" name="number" value="<?=isset($_GET['number']) ? $_GET['number'] : ''?>" /></td>
</tr>
<tr>
	<td><input type="hidden" name="is_search" value="1" /></td>
	<td><input type="submit" class="button" value="查询" /></td>
</tr>
</table>
</form>
</fieldset>
<?if (isset($data)):?>
<table class="list_table" width="80%">
<tr>
	<th width="60">周数</th>
	<th>产品编号</th>
	<th>产品名称</th>
	<th width="60">数量</th>
	<th>总金额</th>
	<th>更新时间</th>
</tr>
<?$total_amount = 0;?>
<?foreach ($data as $d):?>
<?$total_amount += $d['amount'];?>
<tr>
	<td>第<?=date('W', strtotime($d['update_time']))?>周</td>
	<td>
		<?=$d['number']?>
		<?if ($d['pic_url']):?>
			<?$pretty_photo_number = 0;?>
			<?foreach ($d['pic_url'] as $dp):?>
			<a rel="pretty_photo[<?=$d['id']?>]" href="<?=$dp?>"><?if(!$pretty_photo_number):?><span class="img_icon"></span><?endif;?></a>
			<?$pretty_photo_number = 1;?>
			<?endforeach;?>
		<?endif;?>
	</td>
	<td align="left"><?=$d['name']?></td>
	<td><?=$d['quantity']?></td>
	<td><?=$d['amount']?></td>
	<td><?=$d['update_time']?></td>
</tr>
<?endforeach;?>
</table>
<p><strong>总金额： RMB <?=$total_amount;?></strong></p>
<?endif;?>
<?php $this->_endblock();?>